$(document).ready(function() {

	function getParams(){       //收集请求参数
		var tId=$.trim($("#tId").val());
		var tTime=$.trim($("#tTime").val());
	    var tPerson=$.trim($("#tPerson").val());
		var reason=$.trim($("#reason").val());
		params = {
				"queryOption['taskid']":tId,
		 		"queryOption['toTime']":tTime,
				"queryOption['toReason']":reason,	
				"queryOption['tPerson']":tPerson	
				};
		return params;
	}
	
	function doAjax(d){
		$.ajax({
			type : "post",
			url: "lzw/TaskOver_request.action",
			data : d,
			success : function(data){
			alert(data.message);
			window.location.href="/ag/lzw/task_over_request_list.jsp"; 
		}
       });
	}
	
	$("#submit").click(function(){	
		  var tTime=$.trim($("#tTime").val());
		  var reason=$.trim($("#reason").val());
		  if(tTime==""||reason==""){
			  alert("请认真填写申请表各项内容！");
			  return;
		  }else{
		  doAjax(getParams());
		  }	  
	});
	
});	

